#include <Arduino.h>
#include <Scheduler.h>
#include "app_log.h"
#include "app_config.h"
#include "app_mqtt.h"
#include "app_ir.h"

void setup()
{
    LOG_BAUDRATE(115200);
    LOG_INFO("\r\n");

    pinMode(D5, INPUT);
    pinMode(D6, INPUT);

    auto *config_task = new ConfigTask(
            digitalRead(D5) == HIGH,
            digitalRead(D6) == HIGH
    );
    SchedulerClass::start(config_task);


    if (!config_task->configMode)
    {
        auto *network_task = new NetworkTask();

        auto *ir_recv_task = new InfraredTask(network_task);

        SchedulerClass::start(ir_recv_task);
        SchedulerClass::start(network_task);
    }

    SchedulerClass::begin();
}

void loop()
{

}
